<!-- 配置司机 -->
<template>
  <div class="descriptions">
    <el-descriptions v-model="dreverCarList" :column="2">
      <el-descriptions-item label="车牌号">{{ dreverCarList.licensePlate }}</el-descriptions-item>
      <el-descriptions-item label="车型">{{ dreverCarList.truckTypeName }}</el-descriptions-item>
      <el-descriptions-item label="车辆转态">{{ dreverCarList.workStatus }}</el-descriptions-item>
      <el-descriptions-item label="实载重量">{{ dreverCarList.allowableLoad }}</el-descriptions-item>
      <el-descriptions-item label="实载体积">{{ dreverCarList.allowableVolume }}</el-descriptions-item>
    </el-descriptions>
    <el-table :data="UndreverList" style="width: 100%">
      <el-table-column type="index" label="序号" />
      <el-table-column prop="name" label="司机名称" />
      <el-table-column label="操作">
        <template slot-scope="{ row }">
          <el-button
            type="text"
            size="small"
            @click="look(row,id)"
          >查看</el-button>
          <el-divider direction="vertical" />
          <el-button
            :disabled="row.status === 1"
            type="text"
            size="small"
            style="color: red;"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { getDriverApi } from '@/api/driver'
import { getDetailVehicleList } from '@/api/vehicle'
export default {
  name: 'AddModels',
  data: function() {
    return {
      // 司机信息
      UndreverList: [],
      // 车辆信息列表
      dreverCarList: []
    }
  },
  async created() {
    await this.getDriverApi()
    await this.getDetailVehicleList()
  },
  methods: {
    // 获取未绑定车辆的司机
    async getDriverApi() {
      const { data } = await getDriverApi()
      this.UndreverList = data
    },
    async getDetailVehicleList() {
      const { data } = await getDetailVehicleList(this.UndreverId)
      this.dreverCarList = data
      console.log(data)
    },
    closeDialog() {
      // 设置变量关闭弹窗
      this.$emit('update:innerVisible', false)
    }
  }
}
</script>

<style>
.descriptions{
 background-color: #fff;
 padding: 30px 30px 15px;
 margin-bottom: 20px;
}
</style>
